import { Routes, Route, Navigate } from 'react-router-dom';
import DashboardLayout from '../components/DashboardLayout';
import ProtectedAdminRoute from '../components/ProtectedAdminRoute';
import Overview from './dashboard/Overview';
import DynamicProxy from './dashboard/DynamicProxy';
import StaticProxy from './dashboard/StaticProxy';
import IPv6Proxy from './dashboard/IPv6Proxy';
import Analytics from './dashboard/Analytics';
import APIDocs from './dashboard/APIDocs';
import Billing from './dashboard/Billing';
import Settings from './dashboard/Settings';
import Cart from './dashboard/Cart';
import Orders from './dashboard/Orders';
import PurchaseDynamicResidential from './dashboard/PurchaseDynamicResidential';
import PurchaseStaticResidential from './dashboard/PurchaseStaticResidential';
import PurchaseDatacenterIPv6 from './dashboard/PurchaseDatacenterIPv6';
import Affiliates from './dashboard/Affiliates';
import Support from './dashboard/Support';
import CreateTicket from './dashboard/CreateTicket';
import TicketDetail from './dashboard/TicketDetail';
import AdminUserManagement from './dashboard/AdminUserManagement';

const Dashboard = () => {
  return (
    <DashboardLayout>
      <Routes>
        <Route index element={<Overview />} />
        <Route path="/" element={<Overview />} />
        <Route path="/dynamic" element={<DynamicProxy />} />
        <Route path="/static" element={<StaticProxy />} />
        <Route path="/ipv6" element={<IPv6Proxy />} />
        <Route path="/analytics" element={<Analytics />} />
        <Route path="/api-docs" element={<APIDocs />} />
        <Route path="/billing" element={<Billing />} />
        <Route path="/affiliates" element={<Affiliates />} />
        <Route path="/support" element={<Support />} />
        <Route path="/support/create" element={<CreateTicket />} />
        <Route path="/support/ticket/:ticketId" element={<TicketDetail />} />
        <Route path="/settings" element={<Settings />} />
        <Route path="/cart" element={<Cart />} />
        <Route path="/orders" element={<Orders />} />
        <Route path="/purchase-dynamic-residential" element={<PurchaseDynamicResidential />} />
        <Route path="/purchase-static-residential" element={<PurchaseStaticResidential />} />
        <Route path="/purchase-datacenter-ipv6" element={<PurchaseDatacenterIPv6 />} />
        <Route path="/admin/users" element={
          <ProtectedAdminRoute>
            <AdminUserManagement />
          </ProtectedAdminRoute>
        } />
        <Route path="*" element={<Navigate to="/dashboard" replace />} />
      </Routes>
    </DashboardLayout>
  );
};

export default Dashboard;
